﻿using ReflectionStudio.Core.Events;
using System;
using System.ComponentModel;
using System.Data;
using System.Windows;
namespace WPFExcelReport
{
    public partial class UICCWBBEW : ViewBase
    {
        public VICC_WBBEW TMV
        {
            get
            {
                return (VICC_WBBEW)MV;
            }
        }

        #region ==dwWB===========
        public static readonly DependencyProperty dwWBProperty = DependencyProperty.Register("dwWB",
            typeof(DataRow), typeof(UICCWBBEW),
            new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OndwWBChanged));
        public DataRow dwWB
        {
            get
            {
                return (DataRow)GetValue(dwWBProperty);
            }
            set
            {
                SetValue(dwWBProperty, value);
            }
        }
        private static void OndwWBChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UICCWBBEW;
            if (src != null)
            {
                src.dwWB = (DataRow)e.NewValue;
            }
        }
        #endregion

        #region ==dwWB14===========
        public static readonly DependencyProperty dwWB14Property = DependencyProperty.Register("dwWB14",
            typeof(DataRow), typeof(UICCWBBEW),
            new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OndwWB14Changed));
        public DataRow dwWB14
        {
            get
            {
                return (DataRow)GetValue(dwWB14Property);
            }
            set
            {
                SetValue(dwWB14Property, value);
            }
        }
        private static void OndwWB14Changed(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UICCWBBEW;
            if (src != null)
            {
                src.dwWB14 = (DataRow)e.NewValue;
            }
        }
        #endregion

        #region ==WBEWBS===========
        public static readonly DependencyProperty WBEWBSProperty = DependencyProperty.Register("WBEWBS",
            typeof(string), typeof(UICCWBBEW),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnWBEWBSChanged));
        public string WBEWBS
        {
            get
            {
                return (string)GetValue(WBEWBSProperty);
            }
            set
            {
                SetValue(WBEWBSProperty, value);
            }
        }
        private static void OnWBEWBSChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UICCWBBEW;
            if (src != null)
            {
                src.WBEWBS = (string)e.NewValue;
            }
        }
        #endregion

        #region ==WPOS===========
        public static readonly DependencyProperty WPOSProperty = DependencyProperty.Register("WPOS",
            typeof(int), typeof(UICCWBBEW),
            new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnWPOSChanged));
        public int WPOS
        {
            get
            {
                return (int)GetValue(WPOSProperty);
            }
            set
            {
                SetValue(WPOSProperty, value);
            }
        }
        private static void OnWPOSChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UICCWBBEW;
            if (src != null)
            {
                src.WPOS = (int)e.NewValue;
            }
        }
        #endregion

        #region ==RWAUF===========
        public static readonly DependencyProperty RWAUFProperty = DependencyProperty.Register("RWAUF",
            typeof(string), typeof(UICCWBBEW),
            new FrameworkPropertyMetadata("", FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnRWAUFChanged));
        public string RWAUF
        {
            get
            {
                return (string)GetValue(RWAUFProperty);
            }
            set
            {
                SetValue(RWAUFProperty, value);
                OnRWAUFChg(value);
            }
        }
        private static void OnRWAUFChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UICCWBBEW;
            if (src != null)
            {
                src.RWAUF = (string)e.NewValue;
            }
        }
        #endregion

        #region ==IsShowEKGB===========
        public static readonly DependencyProperty IsShowEKGBProperty = DependencyProperty.Register("IsShowEKGB",
            typeof(bool), typeof(UICCWBBEW),
            new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnIsShowEKGBChanged));
        public bool IsShowEKGB
        {
            get
            {
                return (bool)GetValue(IsShowEKGBProperty);
            }
            set
            {
                SetValue(IsShowEKGBProperty, value);
                OnShowEKGBChg(value);
            }
        }
        private static void OnIsShowEKGBChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UICCWBBEW;
            if (src != null)
            {
                src.IsShowEKGB = (bool)e.NewValue;
            }
        }
        #endregion

        #region ==ROLLS===========
        public static readonly DependencyProperty ROLLSProperty = DependencyProperty.Register("ROLLS",
            typeof(double), typeof(UICCWBBEW),
            new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnROLLSChanged));
        public double ROLLS
        {
            get
            {
                return (double)GetValue(ROLLSProperty);
            }
            set
            {
                SetValue(ROLLSProperty, value);
            }
        }
        private static void OnROLLSChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UICCWBBEW;
            if (src != null)
            {
                src.ROLLS = (double)e.NewValue;
            }
        }
        #endregion

        #region ==RLG===========
        public static readonly DependencyProperty RLGProperty = DependencyProperty.Register("RLG",
            typeof(double), typeof(UICCWBBEW),
            new FrameworkPropertyMetadata(0.0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnRLGChanged));
        public double RLG
        {
            get
            {
                return (double)GetValue(RLGProperty);
            }
            set
            {
                SetValue(RLGProperty, value);
            }
        }
        private static void OnRLGChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UICCWBBEW;
            if (src != null)
            {
                src.RLG = (double)e.NewValue;
            }
        }
        #endregion

        #region ==TBWB===========
        public static readonly DependencyProperty TBWBProperty = DependencyProperty.Register("TBWB",
            typeof(DataTable), typeof(UICCWBBEW),
            new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, OnTBWBChanged));
        public DataTable TBWB
        {
            get
            {
                return (DataTable)GetValue(TBWBProperty);
            }
            set
            {
                SetValue(TBWBProperty, value);
                if (MV == null)
                    return;
                ((VICC_WBBEW)MV).TBWB = value;
            }
        }
        private static void OnTBWBChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
        {
            var src = sender as UICCWBBEW;
            if (src != null)
            {
                src.TBWB = (DataTable)e.NewValue;
            }
        }
        #endregion

        public UICCWBBEW()
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
        }
        public override void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(this))
                return;
            base.Window_Loaded(sender, e);

        }
        public override void vwMaster_CurrentChanged(object sender, EventArgs e)
        {
            base.vwMaster_CurrentChanged(sender, e);
            dwWB14 = dwMaster;
        }

        public virtual void OnShowEKGBChg(bool value)
        {
        }

        public virtual void OnRWAUFChg(string value)
        {
        }
       
    }
}
